/*
 * @Author: zehao.chen
 * @Date: 2022-07-31 18:04:32
 * @LastEditors: zehao.chen
 * @LastEditTime: 2022-08-24 18:36:37
 * @FilePath: /meeting-admin/src/api/template.js
 * @Description: 
 * 
 */
import http from '@/utils/request'

/**
 * @description: 新建模板库
 * @return {*}
 */
export const addTemplate = (data, config) => {
  return http.post('/pc/templateLib/addTemplate', data, config)
}

/**
 * @description: 获取模板库
 * @return {*}
 */
export const getTemplateList = (data) => {
  const { createName, templateName, pageSize, pageNum } = data || {}
  return http({
    method: 'GET',
    url: `/pc/templateLib/getTemplateList`,
    params: {
      createName,
      templateName,
      pageNum,
      pageSize
    }
  })
}

/**
 * @description: 查询是否有模板草稿
 * @return {*}
 */
export const isHaveDraft = (type,meetingId = '') => {
  return http.get(`/pc/templateLib/isHaveDraft?type=${type}&meetingId=${meetingId}`)
}

/**
 * @description: 删除座位模板
 * @return {*}
 */
export const updateDelFlagByTemplateIds = (templateIds) => {
  return http.post(`/pc/templateLib/updateDelFlagByTemplateIds?templateIds=${templateIds}`)
}


/**
 * @description: 应用模板
 * @return {*}
 */
export const useTemplate = (meetingId, templateId) => {
  return http.put(`/pc/templateLib/useTemplate?meetingId=${meetingId}&templateId=${templateId}`)
}
